
#ifndef  _RADIX_ARCHAISM_THREAD_H_
#define  _RADIX_ARCHAISM_THREAD_H_

#include <Archaism/Header.h>

_BeginNamespace(Radix)
/*
============================================================
== Thread
============================================================
*/
class Thread
{
	_ForbidCopy(Thread);
	_ForbidAssign(Thread);

public:
	static void sleep(ulong ms);

public:
	Thread();
	virtual ~Thread();

public:
	virtual void run();

public:
	bool start();
	void stop();
	void suspend();
	void resume();
	bool isRuning();
	bool setPriority(int priority);
	int priority();

private:
	struct ThreadAttribute* mAttribute;
};
/*
============================================================
== CriticalSection
============================================================
*/
class CriticalSection
{
public:
	CriticalSection();
	virtual ~CriticalSection();

public:
	bool trylock();
	void lock();
	void unlock();

private:
	struct CriticalSectionAttribute* mAttribute;
};
/*
============================================================
== Mutex
============================================================
*/
class Mutex
{
public:
	Mutex();
	virtual ~Mutex();

public:
	bool trylock(ulong ms = 0);
	void lock();
	void unlock();

private:
	struct MutexAttribute* mAttribute;
};

_EndNamespace(Radix)

#endif//_RADIX_ARCHAISM_THREAD_H_
